package com.todo.biz.application.convert;

import com.google.api.client.util.Lists;
import com.todo.biz.application.entity.bo.*;
import com.todo.biz.application.entity.context.SimpleBusinessDataContext;
import com.todo.biz.common.enums.CommentTypeEnum;
import com.todo.biz.common.enums.FeedbackTypeEnum;
import com.todo.biz.iface.frontend.request.InsertCommendParam;
import com.todo.biz.iface.frontend.request.InsertFeedbackParam;
import com.todo.biz.iface.frontend.request.UpdateFeedbackParam;
import com.todo.biz.iface.frontend.response.*;
import com.todo.biz.service.api.response.BaseExamineResponse;
import com.todo.biz.service.api.response.BizCounterBaseResponse;
import com.todo.common.common.entity.BaseUserVO;
import com.todo.common.common.entity.response.page.PageResult;
import com.todo.common.common.enums.BusinessSceneEnum;
import com.todo.common.utils.DateUtils;
import com.todo.common.utils.TodoCommonUtils;
import com.todo.delicacy.service.api.response.RestaurantInfoResponse;
import com.todo.sight.service.api.response.SightInfoResponse;
import com.todo.strategy.online.service.api.response.PlanSetInfoResponse;
import com.todo.strategy.online.service.api.response.PlatformStrategyBaseResponse;
import com.todo.user.api.response.BatchQuerySimplyUserInfoResponse;
import org.apache.commons.collections4.CollectionUtils;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2024/5/28 18:24
 * @description
 */
public class BizBaseConvert {

    public static CollectSetVO convertToCollectSetVO(CollectSetBO collectSetResponse) {
        if (collectSetResponse == null) {
            return null;
        }
        CollectSetVO collectSetVO = new CollectSetVO();
        collectSetVO.setCollectCount(collectSetResponse.getCollectCount());
        collectSetVO.setCollectRule(collectSetResponse.getCollectRule());
        collectSetVO.setCity(collectSetResponse.getCity());
        collectSetVO.setCollectTypeStr(collectSetResponse.getCollectType() == null ? null : collectSetResponse.getCollectType().getName());
        collectSetVO.setCollectType(collectSetResponse.getCollectType() == null ? null : collectSetResponse.getCollectType().getType());
        collectSetVO.setDesc(collectSetResponse.getDesc());
        collectSetVO.setDesc(collectSetResponse.getDesc());
        collectSetVO.setCollectId(collectSetResponse.getId());
        collectSetVO.setMainImg(collectSetResponse.getMainImg());
        collectSetVO.setProvince(collectSetResponse.getProvince());
        collectSetVO.setTitle(collectSetResponse.getTitle());
        return collectSetVO;
    }

    public static List<CollectSetVO> convertToCollectSetVOList(List<CollectSetBO> collectSetResponses) {
        if (CollectionUtils.isEmpty(collectSetResponses)) {
            return Lists.newArrayList();
        }
        return collectSetResponses.stream().map(BizBaseConvert::convertToCollectSetVO).collect(Collectors.toList());
    }


    public static List<CollectRestaurantSetVO> convertToCollectRestaurantSetVOList(List<RestaurantInfoResponse> restaurantInfoResponses, Long collectId) {
        if (CollectionUtils.isEmpty(restaurantInfoResponses)) {
            return Lists.newArrayList();
        }
        return restaurantInfoResponses.stream().map(item -> convertToCollectRestaurantSetVO(item, collectId)).collect(Collectors.toList());
    }

    public static CollectRestaurantSetVO convertToCollectRestaurantSetVO(RestaurantInfoResponse restaurantInfoResponse, Long collectId) {
        if (restaurantInfoResponse == null) {
            return null;
        }
        CollectRestaurantSetVO collectRestaurantSetVO = new CollectRestaurantSetVO();
        collectRestaurantSetVO.setBizId(String.valueOf(restaurantInfoResponse.getRestaurantId()));
        collectRestaurantSetVO.setSetId(String.valueOf(collectId));
        collectRestaurantSetVO.setName(restaurantInfoResponse.getName());
        collectRestaurantSetVO.setSummary(restaurantInfoResponse.getDesc());
        collectRestaurantSetVO.setMainImg(restaurantInfoResponse.getMainImg());
        collectRestaurantSetVO.setScore(restaurantInfoResponse.getScore());
        collectRestaurantSetVO.setMoneyCost(restaurantInfoResponse.getMoneyCost());
        collectRestaurantSetVO.setRestaurantType(restaurantInfoResponse.getRestaurantType() == null ? null : restaurantInfoResponse.getRestaurantType().getType());
        collectRestaurantSetVO.setRestaurantTypeStr(restaurantInfoResponse.getRestaurantType() == null ? null : restaurantInfoResponse.getRestaurantType().getName());
        collectRestaurantSetVO.setStorePoiId(restaurantInfoResponse.getStorePoiId());
        collectRestaurantSetVO.setCity(restaurantInfoResponse.getCity());
        collectRestaurantSetVO.setProvince(restaurantInfoResponse.getProvince());
        return collectRestaurantSetVO;
    }

    public static List<CollectSightSetVO> convertToCollectSightSetVOList(List<SightInfoResponse> sightInfoResponses, Long collectId) {
        if (CollectionUtils.isEmpty(sightInfoResponses)) {
            return Lists.newArrayList();
        }
        return sightInfoResponses.stream().map(item -> BizBaseConvert.convertToCollectSightSetVO(item, collectId)).collect(Collectors.toList());
    }

    public static CollectSightSetVO convertToCollectSightSetVO(SightInfoResponse sightInfoResponse, Long collectId) {
        if (sightInfoResponse == null) {
            return null;
        }
        CollectSightSetVO collectSightSetVO = new CollectSightSetVO();
        collectSightSetVO.setBizId(String.valueOf(sightInfoResponse.getSightId()));
        collectSightSetVO.setHot(sightInfoResponse.getHot());
        collectSightSetVO.setAddress(sightInfoResponse.getAddress());
        collectSightSetVO.setScore(sightInfoResponse.getScore());
        collectSightSetVO.setTitle(sightInfoResponse.getTitle());
        collectSightSetVO.setSlogan(sightInfoResponse.getSlogan());
        collectSightSetVO.setMainImg(sightInfoResponse.getMainImg());
        collectSightSetVO.setSightPoiId(sightInfoResponse.getPoiId());
        collectSightSetVO.setCity(sightInfoResponse.getCity());
        collectSightSetVO.setSetId(String.valueOf(collectId));
        collectSightSetVO.setProvince(sightInfoResponse.getProvince());
        return collectSightSetVO;

    }

    public static List<CollectUserStrategySetVO> convertToCollectUserStrategySetVOList(List<PlanSetInfoResponse> planSetBaseResponseList, Long collectId) {
        if (CollectionUtils.isEmpty(planSetBaseResponseList)) {
            return Lists.newArrayList();
        }
        return planSetBaseResponseList.stream().map(item -> BizBaseConvert.convertToCollectUserStrategySetVO(item, collectId)).collect(Collectors.toList());
    }

    public static CollectUserStrategySetVO convertToCollectUserStrategySetVO(PlanSetInfoResponse planSetBaseResponse, Long collectId) {
        if (planSetBaseResponse == null) {
            return null;
        }
        CollectUserStrategySetVO collectUserStrategySetVO = new CollectUserStrategySetVO();
        collectUserStrategySetVO.setBizId(String.valueOf(planSetBaseResponse.getPlanId()));
        collectUserStrategySetVO.setTitle(planSetBaseResponse.getTitle());
        collectUserStrategySetVO.setPlanTime(buildPlanTime(planSetBaseResponse.getStartPlanTime(), planSetBaseResponse.getEndPlanTime()));
        collectUserStrategySetVO.setPlanCity(planSetBaseResponse.getPlanCity());
        collectUserStrategySetVO.setPlanType(planSetBaseResponse.getPlanType() == null ? null : planSetBaseResponse.getPlanType().getName());
        collectUserStrategySetVO.setPlanMoneySpend(planSetBaseResponse.getPlanMoneySpend());
        collectUserStrategySetVO.setMainImg(planSetBaseResponse.getMainImg());
        collectUserStrategySetVO.setSetId(String.valueOf(collectId));
        collectUserStrategySetVO.setRelationCount(planSetBaseResponse.getRelationCount());
        return collectUserStrategySetVO;
    }

    private static String buildPlanTime(Date startPlanTime, Date endPlanTime) {
        return String.format("%s ~ %s", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, startPlanTime), DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, endPlanTime));
    }

    public static List<CollectPlatformStrategySetVO> convertToCollectPlatformStrategySetVOList(List<PlatformStrategyBaseResponse> platformStrategyBaseResponses, Long collectId) {
        if (CollectionUtils.isEmpty(platformStrategyBaseResponses)) {
            return Lists.newArrayList();
        }
        return platformStrategyBaseResponses.stream().map(item -> BizBaseConvert.convertToCollectPlatformStrategySetVO(item, collectId)).collect(Collectors.toList());
    }

    public static CollectPlatformStrategySetVO convertToCollectPlatformStrategySetVO(PlatformStrategyBaseResponse platformStrategyBaseResponse, Long collectId) {
        if (platformStrategyBaseResponse == null) {
            return null;
        }
        CollectPlatformStrategySetVO collectPlatformStrategySetVO = new CollectPlatformStrategySetVO();
        collectPlatformStrategySetVO.setBizId(String.valueOf(platformStrategyBaseResponse.getStrategyId()));
        collectPlatformStrategySetVO.setTitle(platformStrategyBaseResponse.getTitle());
        collectPlatformStrategySetVO.setTravelTimeType(platformStrategyBaseResponse.getTravelTimeType() == null ? null : platformStrategyBaseResponse.getTravelTimeType().getName());
        collectPlatformStrategySetVO.setStrategyType(platformStrategyBaseResponse.getStrategyType() == null ? null : platformStrategyBaseResponse.getStrategyType().getType());
        collectPlatformStrategySetVO.setScore(platformStrategyBaseResponse.getScore());
        collectPlatformStrategySetVO.setMainImg(platformStrategyBaseResponse.getMainImg());
        collectPlatformStrategySetVO.setRecommendMonth(platformStrategyBaseResponse.getRecommendMonth());
        collectPlatformStrategySetVO.setCity(platformStrategyBaseResponse.getCity());
        collectPlatformStrategySetVO.setMoneyCost(platformStrategyBaseResponse.getMoneyCost());
        collectPlatformStrategySetVO.setReferenceCount(platformStrategyBaseResponse.getReferenceCount());
        collectPlatformStrategySetVO.setSetId(String.valueOf(collectId));
        collectPlatformStrategySetVO.setStrategyTypeStr(platformStrategyBaseResponse.getStrategyType() == null ? null : platformStrategyBaseResponse.getStrategyType().getName());
        return collectPlatformStrategySetVO;
    }


    public static FeedbackBO convertToFeedbackBO(InsertFeedbackParam param) {
        if (param == null) {
            return null;
        }
        FeedbackBO feedbackBO = new FeedbackBO();
        feedbackBO.setTitle(param.getTitle());
        feedbackBO.setContent(param.getContent());
        feedbackBO.setFeedbackType(FeedbackTypeEnum.getByType(param.getFeedbackType()));
        feedbackBO.setBusinessScene(BusinessSceneEnum.getBusinessSceneEnumByScene(param.getBusinessScene()));
        feedbackBO.setBusinessId(Long.valueOf(param.getBusinessId()));
        FeedbackBO.Extra extra = new FeedbackBO.Extra();
        extra.setUserPhone(param.getUserPhone());
        extra.setImgList(param.getImgList());
        feedbackBO.setExtra(extra);
        feedbackBO.setCreateUser(param.get_user().getUserId());
        feedbackBO.setIsSolve(0);
        return feedbackBO;
    }

    public static FeedbackBO convertToFeedbackBO(UpdateFeedbackParam param) {
        if (param == null) {
            return null;
        }
        FeedbackBO feedbackBO = new FeedbackBO();
        feedbackBO.setId(Long.valueOf(param.getFeedbackId()));
        feedbackBO.setTitle(param.getTitle());
        feedbackBO.setContent(param.getContent());
        feedbackBO.setFeedbackType(FeedbackTypeEnum.getByType(param.getFeedbackType()));
        FeedbackBO.Extra extra = new FeedbackBO.Extra();
        extra.setUserPhone(param.getUserPhone());
        extra.setImgList(param.getImgList());
        feedbackBO.setExtra(extra);
        feedbackBO.setCreateUser(param.get_user().getUserId());
        return feedbackBO;
    }


    public static FeedbackDetailVO convertToFeedbackDetailVO(FeedbackDetailBO feedbackDetailBO) {
        if (feedbackDetailBO == null) {
            return null;
        }
        FeedbackDetailVO feedbackDetailVO = new FeedbackDetailVO();
        feedbackDetailVO.setTitle(feedbackDetailBO.getTitle());
        feedbackDetailVO.setContent(feedbackDetailBO.getContent());
        feedbackDetailVO.setFeedbackType(feedbackDetailBO.getFeedbackType() == null ? null : feedbackDetailBO.getFeedbackType().getType());
        feedbackDetailVO.setBusinessScene(feedbackDetailBO.getBusinessScene() == null ? null : feedbackDetailBO.getBusinessScene().getScene());
        feedbackDetailVO.setBusinessId(String.valueOf(feedbackDetailBO.getBusinessId()));
        feedbackDetailVO.setFeedbackId(String.valueOf(feedbackDetailBO.getId()));
        feedbackDetailVO.setStatus(feedbackDetailBO.getStatus() == null ? null : feedbackDetailBO.getStatus().getName());
        feedbackDetailVO.setIsSolve(feedbackDetailBO.getIsSolve());
        if (feedbackDetailBO.getExtra() != null) {
            FeedbackDetailBO.Extra extra = feedbackDetailBO.getExtra();
            feedbackDetailVO.setUserPhone(extra.getUserPhone());
            feedbackDetailVO.setImgList(extra.getImgList());
        }
        return feedbackDetailVO;
    }


    public static PageResult<FeedbackBaseVO> convertToFeedbackBaseVOPageResult(PageResult<FeedbackBO> feedbackResponsePageResult) {
        if (feedbackResponsePageResult == null) {
            return null;
        }
        if (CollectionUtils.isEmpty(feedbackResponsePageResult.getResults())) {
            return PageResult.of(null, feedbackResponsePageResult.getPageNum(), feedbackResponsePageResult.getPageSize(), feedbackResponsePageResult.getTotal());
        }
        PageResult<FeedbackBaseVO> pageResult = new PageResult<>();
        pageResult.setCurrentIndex(feedbackResponsePageResult.getCurrentIndex());
        pageResult.setPageCount(feedbackResponsePageResult.getPageCount());
        pageResult.setPageNum(feedbackResponsePageResult.getPageNum());
        pageResult.setPageSize(feedbackResponsePageResult.getPageSize());
        pageResult.setHasNext(feedbackResponsePageResult.isHasNext());
        pageResult.setResults(feedbackResponsePageResult.getResults().stream().map(BizBaseConvert::convertToFeedbackBaseVO).collect(Collectors.toList()));
        return pageResult;
    }

    private static FeedbackBaseVO convertToFeedbackBaseVO(FeedbackBO feedbackBO) {
        if (feedbackBO == null) {
            return null;
        }
        FeedbackBaseVO feedbackBaseVO = new FeedbackBaseVO();
        feedbackBaseVO.setTitle(feedbackBO.getTitle());
        feedbackBaseVO.setFeedbackType(feedbackBO.getFeedbackType() == null ? null : feedbackBO.getFeedbackType().getName());
        feedbackBaseVO.setBusinessScene(feedbackBO.getBusinessScene() == null ? null : feedbackBO.getBusinessScene().getSceneDesc());
        feedbackBaseVO.setBusinessId(String.valueOf(feedbackBO.getBusinessId()));
        feedbackBaseVO.setFeedbackId(String.valueOf(feedbackBO.getId()));
        feedbackBaseVO.setStatus(feedbackBO.getStatus() == null ? null : feedbackBO.getStatus().getName());
        if (feedbackBO.getExtra() != null) {
            FeedbackBO.Extra extra = feedbackBO.getExtra();
            if (!CollectionUtils.isEmpty(extra.getImgList())) {
                feedbackBaseVO.setFirstImg(extra.getImgList() == null ? null : extra.getImgList().get(0));
            }
        }
        return feedbackBaseVO;

    }


    public static CommentBO convertToCommentBO(InsertCommendParam param) {
        if (param == null) {
            return null;
        }
        CommentBO commentBO = new CommentBO();
        commentBO.setId(TodoCommonUtils.buildLongGuid());
        commentBO.setParentId(Long.valueOf(param.getParentId()));
        commentBO.setCommentUser(param.get_user().getUserId());
        commentBO.setCommentImg(param.getCommentImg());
        commentBO.setComments(param.getComments());
        commentBO.setBeRepliedUser(Long.valueOf(param.getBeRepliedUserId()));
        commentBO.setCommentType(CommentTypeEnum.getByType(param.getCommentType()));
        commentBO.setBusinessScene(BusinessSceneEnum.getBusinessSceneEnumByScene(param.getBusinessScene()));
        commentBO.setIsTop(0);
        commentBO.setIsHide(0);
        commentBO.setCommentStorey(1);
        commentBO.setLikeCount(0);
        commentBO.setChildCount(0);
        return commentBO;
    }

    public static PageResult<CommentVO> convertToCommentVOPageResult(PageResult<CommentBO> commentResponsePageResult, Map<Long, BatchQuerySimplyUserInfoResponse.SimplyUserInfo> simplyUserInfoMap) {
        if (commentResponsePageResult == null || simplyUserInfoMap == null) {
            return null;
        }
        if (CollectionUtils.isEmpty(commentResponsePageResult.getResults())) {
            return PageResult.of(null, commentResponsePageResult.getPageNum(), commentResponsePageResult.getPageSize(), commentResponsePageResult.getTotal());
        }
        PageResult<CommentVO> pageResult = new PageResult<>();
        pageResult.setCurrentIndex(commentResponsePageResult.getCurrentIndex());
        pageResult.setPageCount(commentResponsePageResult.getPageCount());
        pageResult.setPageNum(commentResponsePageResult.getPageNum());
        pageResult.setPageSize(commentResponsePageResult.getPageSize());
        pageResult.setHasNext(commentResponsePageResult.isHasNext());
        pageResult.setResults(commentResponsePageResult.getResults().stream().map(item -> convertToCommentVO(item, simplyUserInfoMap)).collect(Collectors.toList()));
        return pageResult;
    }

    public static CommentVO convertToCommentVO(CommentBO commentResponse, Map<Long, BatchQuerySimplyUserInfoResponse.SimplyUserInfo> simplyUserInfoMap) {
        if (commentResponse == null || simplyUserInfoMap == null) {
            return null;
        }
        CommentVO commentVO = new CommentVO();
        commentVO.setCommentImg(commentResponse.getCommentImg());
        commentVO.setComments(commentResponse.getComments());
        commentVO.setBaseUser(convertToBaseUserVO(simplyUserInfoMap.get(commentResponse.getCommentUser())));
        commentVO.setCommentId(String.valueOf(commentResponse.getId()));
        commentVO.setCommentType(commentResponse.getCommentType() == null ? null : commentResponse.getCommentType().getType());
        commentVO.setBeRepliedUser(convertToBaseUserVO(simplyUserInfoMap.get(commentResponse.getBeRepliedUser())));
        commentVO.setBusinessScene(commentResponse.getBusinessScene() == null ? null : commentResponse.getBusinessScene().getScene());
        commentVO.setLikeCount(commentResponse.getLikeCount());
        commentVO.setChildCount(commentResponse.getChildCount());
        commentVO.setCommentStorey(commentResponse.getCommentStorey());
        commentVO.setIsTop(commentResponse.getIsTop());
        commentVO.setIsHide(commentResponse.getIsHide());
        commentVO.setParentId(String.valueOf(commentResponse.getParentId()));
        return commentVO;
    }

    public static BaseUserVO convertToBaseUserVO(BatchQuerySimplyUserInfoResponse.SimplyUserInfo simplyUserInfo) {
        if (simplyUserInfo == null) {
            return null;
        }
        BaseUserVO baseUserVO = new BaseUserVO();
        baseUserVO.setUserId(String.valueOf(simplyUserInfo.getUserId()));
        baseUserVO.setUserNikeName(simplyUserInfo.getUserNikeName());
        baseUserVO.setUserAvatar(simplyUserInfo.getUserAvatar());

        return baseUserVO;
    }


    public static PageResult<LikeBusinessDataVO> buildLikeBusinessDataVOList(PageResult<BizAssociateBO> pageResult, Map<Long/*bizId*/, SimpleBusinessDataContext> bizDataMap) {
        if (pageResult == null) {
            return null;
        }
        if (CollectionUtils.isEmpty(pageResult.getResults())) {
            return PageResult.of(null, pageResult.getPageNum(), pageResult.getPageSize(), pageResult.getTotal());
        }
        PageResult<LikeBusinessDataVO> responsePageResult = new PageResult<>();
        responsePageResult.setCurrentIndex(pageResult.getCurrentIndex());
        responsePageResult.setPageCount(pageResult.getPageCount());
        responsePageResult.setPageNum(pageResult.getPageNum());
        responsePageResult.setPageSize(pageResult.getPageSize());
        responsePageResult.setHasNext(pageResult.isHasNext());
        responsePageResult.setResults(pageResult.getResults().stream().map(item -> convertToLikeBusinessDataVO(item, bizDataMap.get(item.getRelationId()))).collect(Collectors.toList()));
        return responsePageResult;
    }

    private static LikeBusinessDataVO convertToLikeBusinessDataVO(BizAssociateBO associateInfoResponse, SimpleBusinessDataContext context) {
        if (associateInfoResponse == null || context == null) {
            return null;
        }
        LikeBusinessDataVO likeBusinessDataVO = new LikeBusinessDataVO();
        likeBusinessDataVO.setCollectCount(context.getCollectCount());
        likeBusinessDataVO.setCommentCount(context.getCommentCount());
        likeBusinessDataVO.setLikeCount(context.getLikeCount());
        likeBusinessDataVO.setTitle(context.getTitle());
        likeBusinessDataVO.setMainImg(context.getMainImg());
        likeBusinessDataVO.setSummary(context.getSummary());
        likeBusinessDataVO.setUser(convertToBaseUserVO(context.getUserInfo()));
        likeBusinessDataVO.setBizId(String.valueOf(associateInfoResponse.getRelationId()));
        likeBusinessDataVO.setBusinessScene(associateInfoResponse.getBusinessScene().getScene());
        return likeBusinessDataVO;
    }

    public static BaseUserVO convertToBaseUserVO(SimpleBusinessDataContext.UserInfo userInfo) {
        if (userInfo == null) {
            return null;
        }
        BaseUserVO baseUserVO = new BaseUserVO();
        baseUserVO.setUserId(String.valueOf(userInfo.getUserId()));
        baseUserVO.setUserNikeName(userInfo.getUserNikeName());
        baseUserVO.setUserAvatar(userInfo.getUserAvatar());

        return baseUserVO;
    }

    public static PageResult<CollectBusinessDataVO> buildCollectBusinessDataVOList(PageResult<BizAssociateBO> pageResult, Map<Long, SimpleBusinessDataContext> bizDataMap) {
        if (pageResult == null) {
            return null;
        }
        if (CollectionUtils.isEmpty(pageResult.getResults())) {
            return PageResult.of(null, pageResult.getPageNum(), pageResult.getPageSize(), pageResult.getTotal());
        }
        PageResult<CollectBusinessDataVO> responsePageResult = new PageResult<>();
        responsePageResult.setCurrentIndex(pageResult.getCurrentIndex());
        responsePageResult.setPageCount(pageResult.getPageCount());
        responsePageResult.setPageNum(pageResult.getPageNum());
        responsePageResult.setPageSize(pageResult.getPageSize());
        responsePageResult.setHasNext(pageResult.isHasNext());
        responsePageResult.setResults(pageResult.getResults().stream().map(item -> convertToCollectBusinessDataVO(item, bizDataMap.get(item.getRelationId()))).collect(Collectors.toList()));
        return responsePageResult;
    }

    private static CollectBusinessDataVO convertToCollectBusinessDataVO(BizAssociateBO associateInfoResponse, SimpleBusinessDataContext context) {
        if (associateInfoResponse == null || context == null) {
            return null;
        }
        CollectBusinessDataVO collectBusinessDataVO = new CollectBusinessDataVO();
        collectBusinessDataVO.setCollectCount(context.getCollectCount());
        collectBusinessDataVO.setCommentCount(context.getCommentCount());
        collectBusinessDataVO.setLikeCount(context.getLikeCount());
        collectBusinessDataVO.setTitle(context.getTitle());
        collectBusinessDataVO.setMainImg(context.getMainImg());
        collectBusinessDataVO.setSummary(context.getSummary());
        collectBusinessDataVO.setUser(convertToBaseUserVO(context.getUserInfo()));
        collectBusinessDataVO.setBizId(String.valueOf(associateInfoResponse.getRelationId()));
        collectBusinessDataVO.setBusinessScene(associateInfoResponse.getBusinessScene().getScene());
        return collectBusinessDataVO;
    }

    public static List<BizCounterBaseResponse> convertToBizCounterBaseResponseList(List<BizCounterBO> bizCounterBOList) {
        if (CollectionUtils.isEmpty(bizCounterBOList)) {
            return Lists.newArrayList();
        }
        return bizCounterBOList.stream().map(BizBaseConvert::convertToBizCounterBaseResponse).collect(Collectors.toList());
    }

    private static BizCounterBaseResponse convertToBizCounterBaseResponse(BizCounterBO bizCounterBO) {
        if (bizCounterBO == null) {
            return null;
        }
        BizCounterBaseResponse bizCounterBaseResponse = new BizCounterBaseResponse();
        bizCounterBaseResponse.setId(bizCounterBO.getId());
        bizCounterBaseResponse.setBusinessId(bizCounterBO.getBusinessId());
        bizCounterBaseResponse.setBusinessScene(bizCounterBO.getBusinessScene());
        bizCounterBaseResponse.setCounterType(bizCounterBO.getCounterType());
        bizCounterBaseResponse.setCount(bizCounterBO.getCount());
        bizCounterBaseResponse.setLastCalTime(bizCounterBO.getLastCalTime());
        return bizCounterBaseResponse;
    }

    public static BaseExamineResponse convertToBaseExamineResponse(ContentExamineData contentExamineData) {
        if (contentExamineData == null) {
            return new BaseExamineResponse();
        }
        BaseExamineResponse baseExamineResponse = new BaseExamineResponse();
        baseExamineResponse.setReviewLevelEnum(contentExamineData.getReviewLevelEnum());
        baseExamineResponse.setRiskTips(contentExamineData.getRiskTips());
        baseExamineResponse.setBizId(contentExamineData.getBizId());
        baseExamineResponse.setSceneEnum(contentExamineData.getSceneEnum());
        return baseExamineResponse;
    }
}
